<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<script type="text/javascript">
$('#tt').tabs({
    border:false,
    onSelect:function(title){
		alert(title+' is selected');
    }
});

/* function sj() {
    //x上限，y下限     
    var x = 100000;
    var y = 0;
    var rand = parseInt(Math.random() * (x - y + 1) + y);
   $("#xxfk_zhunkaozheng2").val(rand)
}

$("#xxfk_zhunkaozheng2").click(function() {
    sj();
}); */

//准考证随机生成
var xxfk_zhunkaozheng2="";
function getRanNum(){
	var ionrem =  $(".gryx").val();
	
	if(ionrem=="招聘"){
		ionrem="ZP";
	}
	if(ionrem=="培训"){
		ionrem="PX";
	}
	if(ionrem=="转职"){
		ionrem="ZZ";
	}
	xxfk_zhunkaozheng2="";
	for(var i=0;i<4;i++){
		var ranNum = Math.ceil(Math.random() * 25); //生成一个0到25的数字
		xxfk_zhunkaozheng2+=String.fromCharCode(65+ranNum);
	}
	
	var data = new Date();
	var years = data.getYear()+1900;
	var year = (years+"").split("")[2]+""+(years+"").split("")[3];
	var month = data.getMonth()+1;
	if(parseInt(month)<10){
		month="0"+month;
	}
	var date = data.getDate();
	if(parseInt(date)<10){
		date="0"+date;
	}
	var ss = year+""+month+""+date;
	
	$("#xxfk_zhunkaozheng2").val(ionrem+""+ss+""+xxfk_zhunkaozheng2.toString());
}

$(function(){
 	$('#xxfk_anpai').datagrid({    
 		//数据源地址
 		url:'xinxifankui',
	    columns:[[
	    	{field:'FEBID',fixed:false,width:120,title:'反馈id',align:'center',hidden:true}, 
	    	{field:'EMPNAME',fixed:false,width:0,title:'',align:'center',hidden:true},
	    	{field:'RSENAME',fixed:false,width:0,title:'',align:'center',hidden:true}, 
	    	{field:'NAME',fixed:false,width:120,title:'姓名',align:'center',
	    		formatter : function(value,row,index){
	        		var empname = row["EMPNAME"];
	        		var rsename = row["RSENAME"];
	        		if(empname==null || empname=="null" || empname==""){
	        			return rsename;
	        		}
	    			return empname;
	        	}
	    	},
	        {field:'IONREM',fixed:false,width:120,title:'个人意向',align:'center'},
	        {field:'ZKZREM',fixed:false,width:120,title:'准考证',align:'center'}, 
	        {field:'FEBMINTIME',fixed:false,width:120,title:'开考时间',align:'center',
	    		formatter : function(value){
	    			if(!isNaN(value)){
	    				return "";
	    			}
	        		var d = new Date(value);
	        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
	        		return times;
	        	}	
	        },  
	        {field:'FEBMAXTIME',fixed:false,width:120,title:'结束时间',align:'center',
	    		formatter : function(value){
	    			if(!isNaN(value)){
	    				return "";
	    			}
	        		var d = new Date(value);
	        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
	        		return times;
	        	}	
	        },
	        {field:'FEBSC',fixed:false,width:120,title:'考试时长',align:'center'},
	        {field:'JULDZ',fixed:false,width:120,title:'考试地点',align:'center'},
	        {field:'FEBSTAT',fixed:false,width:120,title:'反馈状态',align:'center',
	        	formatter : function(value,row,index){
	        		if(value=="-1"){
	        			return "<span style='color:blue'>已处理</span>"
	        		}else if(value=="1"){
	        			return "<span style='color:red'>未处理</span>"
	        		}
	        	}	
	        }
	   
	    ]],
	    pagination:true,
	    pageNumber:1,
	    pageSize:5,
	    pageList:[5,10,15]
	})
});

 

$(function(){
	$("#xxfk_anpai").datagrid({
        //双击事件
        onDblClickRow: function (index,row) {
        	if(row["FEBSC"]!="" && row["JULDZ"]!=""){
        		return alert("该反馈已做处理");
        	} 
        	  $("#xxfk_xiugai").window("open");
        	  $("#xxfk_febid").val(row["FEBID"]);
              $("#xxfk_yixiang").val(row["IONREM"]);
              $(".gryx").val(row["IONREM"]);
              $(".febid").val(row["FEBID"]);
			  getRanNum();
        }
    });
	
	$(".xxfk_xiugai").click(function(){ 
		  var febid=$("#xxfk_febid").val();
          var kaikao=$("#xxfk_kaikaotime2").val();
          var jieshu=$("#xxfk_jieshutime2").val();
          var shichang=$("#xxfk_shichang2").val();
		  var didian=$("#xxfk_didian2").val();
          var zhunkaozheng=$("#xxfk_zhunkaozheng2").val();
          $.ajax({
  			url:"zhunkaozhengpaichong",
  			type:"post",
  			data:{
  				zhunkaozheng:zhunkaozheng
  			  },
  			success:function(data){
  			   if(data==0){
  				 $.ajax({
   					url:"xinxifankui2",
   					type:"post",
   					data:{
   						febid:febid,
   						kaikao:kaikao,
   						jieshu:jieshu,
   						shichang:shichang,
   						didian:didian,
   						zhunkaozheng:zhunkaozheng
   					  },
   					success:function(data){
   						alert("修改成功")
   						$("#xxfk_xiugai").window("close");
   						$( '#xxfk_anpai').datagrid('reload');
   						//数据清空
   				          $("#xxfk_shichang2").val("");
   						  $("#xxfk_didian2").val("");
   				}
   			  })
  			   }else if(data==1){
  				   alert("准考证重复！")
  			   }
  			}
  			  
          })

	})
})
</script>
			<div id="xxfk_xiugai" class="easyui-window" title="考题详情" style="width:700px;height:340px"
		    		data-options="closed:true,minimizable:false,maximizable:false,collapsible:false,modal:true">
		    					<input type="hidden" class="gryx">
		    					<input type="hidden" class="febid" id="xxfk_febid">
		    		             <div class="xxfkxiugai_one">
		    		                   <div class="xxfk_zhunkaozheng2">准考证：<input type="text" class="xxfk_tiqukuang2" id="xxfk_zhunkaozheng2" onClick="getRanNum()" readonly="readonly"></div>
		    		                   <div class="xxfk_yixiang">个人意向：<input type="text" class="xxfk_tiqukuang2" id="xxfk_yixiang" readonly="readonly"></div>
		    		             </div>
		    		             <div class="xxfkxiugai_two">
		    		                   <div class="xxfk_kaikaotime2">开考时间：<input class="easyui-datetimebox" name="birthday"     
                                          data-options="required:true,showSeconds:false"
                                          value="3/4/2010 2:3" style="width:150px"
                                          id="xxfk_kaikaotime2">  
                                       </div>
		    		                   <div class="xxfk_jieshutime2">结束时间：<input class="easyui-datetimebox" name="birthday"     
                                          data-options="required:true,showSeconds:false"
                                          value="3/4/2010 2:3" style="width:150px"
                                          id="xxfk_jieshutime2"> 
                                       </div>
		    		             </div>
		    		             <div class="xxfkxiugai_three">
		    		                   <div class="xxfk_shichang2">考试时长：<input type="text" class="xxfk_tiqukuang" id="xxfk_shichang2"></div>
		    		                   <div class="xxfk_didian2">考试地点：<input type="text" class="xxfk_tiqukuang" id="xxfk_didian2"></div>
		    		             </div>
		    		             <div class="xxfkxiugai_four">
		    		                  <button class="xxfk_xiugai">修改</button>
		    		             </div>
		    		</div>
				    <div class="xinxifankui">
				             <table id="xxfk_anpai" class="easyui-datagrid" style="width:100%;height:450px;margin-top:20px;" data-options="fitColumns:true">
                                 
                            </table>
                            <input type="hidden" id="xxfk_bianhaoid">
				    </div>
</body>
</html>